


//
//  DuoBaoView.m
//  1243
//
//  Created by apple on 16/7/7.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "DuoBaoView.h"
#import "NumberTableViewCell.h"
#import "JoinInformationTVC.h"
#import "KnowTableViewCell.h"
#import "PayTableViewCell.h"

@interface DuoBaoView()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation DuoBaoView
{
    UITableView     *detailView;
}
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        
        
        detailView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        detailView.delegate = self;
        detailView.dataSource = self;
        
        detailView.backgroundColor = [UIColor colorWithRed:228/255.0 green:229/255.0 blue:234/255.0 alpha:1];
        
        [detailView registerClass:[NumberTableViewCell class] forCellReuseIdentifier:@"ONECELL"];
        [detailView registerClass:[JoinInformationTVC class] forCellReuseIdentifier:@"TWOCELL"];
        [detailView registerClass:[KnowTableViewCell class] forCellReuseIdentifier:@"THREECELL"];
        [detailView registerClass:[PayTableViewCell class] forCellReuseIdentifier:@"FOURCELL"];
        
        [self addSubview:detailView];
    }
    return self;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 5;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.01;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        return 210;
    }else if (indexPath.section == 1){
        return 165;
    }else if (indexPath.section == 2){
        return 130;
    }else {
        return 80;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        NumberTableViewCell *cell = [detailView dequeueReusableCellWithIdentifier:@"ONECELL" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }else if (indexPath.section == 1){
        JoinInformationTVC *cell = [detailView dequeueReusableCellWithIdentifier:@"TWOCELL" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }else if (indexPath.section == 2){
        KnowTableViewCell *cell = [detailView dequeueReusableCellWithIdentifier:@"THREECELL" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }else {
        PayTableViewCell *cell = [detailView dequeueReusableCellWithIdentifier:@"FOURCELL" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }
    
}


@end
